$(function(){
    $('.nav div').on('touchstart',function(){
    $(this).siblings().removeClass('active');
    $(this).addClass('active');
        });
    $('.nav_ej div').on('touchstart',function(){
    $(this).siblings().removeClass('active');
    $(this).addClass('active');
        });
})

function show_today(){
	$('.today').show();
	$('.tomorrow').hide();
	$('.afterTomo').hide();
	$('.afAtomo').hide();
}
function show_tomorrow(){
	$('.today').hide();
	$('.tomorrow').show();
	$('.afterTomo').hide();
	$('.afAtomo').hide();
}
function show_afterTomo(){
	$('.today').hide();
	$('.tomorrow').hide();
	$('.afterTomo').show();
	$('.afAtomo').hide();
}
function show_afAtomo(){
	$('.today').hide();
	$('.tomorrow').hide();
	$('.afterTomo').hide();
	$('.afAtomo').show();
}
function show_jcRecordDt(){
	$('.jcRecord_dt').show();
	$('.esInfo_dt').hide();
}
function show_esInfoDt(){
	$('.jcRecord_dt').hide();
	$('.esInfo_dt').show();
}
function endTime(){
    var iSecond,sSecond="",end="";
    if (iTime >= 0){
	    iSecond = parseInt(iTime%60);
	    iMinute = parseInt(iTime/60%60);
	    iHour = parseInt(iTime/3600%24);
	    if (iSecond >= 0){
	        if(iSecond < 10){
	            iSecond = '0' + iSecond.toString();
	        }
	        if(iMinute == 0 && iHour == 0){
	            sSecond = '00:00:' + iSecond;
	        }else{
	            if(iMinute < 10){
	                iMinute = '0' + iMinute.toString();
	            }
	            if(iHour==0 && iMinute != 0){
	                sSecond = '00:' + iMinute + ':' + iSecond;
	            }else{
	                if(iHour < 10){
	                    iHour = '0' + iHour.toString();
	                }
	            	sSecond = iHour + ':' + iMinute + ':' + iSecond;                                
	            }                            
	        }
	    }
	    end=sSecond
	    if(iTime==0){
	        clearTimeout(Account);
	        window.location.href = window.location.href;
	    }else{
	        Account = setTimeout("endTime()",1000);
	        iTime=iTime-1;
	    }
    }
    $('#jishi').html(end);
}
          
var myDate =new Date();
var cc=myDate.toLocaleDateString()+'/20:00:00';//转换成2015-05-13/00:00:00的格式
var nTime=Date.parse(cc);
var djs=(nTime-myDate.getTime())/1000;
var iTime = Number(djs);
if(iTime>0){
    endTime();
}
  

function login(){
	if ($("#phone").val() == "") {
                alert("用户名不能为空！");
                $("#phone").focus();
                return false;
            }
            if ($("#passWord").val() == "") {
                alert("密码不能为空！");
                $("#passWord").focus();
                return false;
            }
            $.ajax({
                type: "POST",
                dataType:'json',
                url: "login.json",
                data:{"name":$("#phone").val(),"password":$("#passWord").val()},
                success: function (data) { 
                    if(data["code"] == "200"){
                        //window.location.reload();
                        //return false;
                    }
                    alert("请确认您输入的用户名或密码输入是否正确！");
                    $("#phone").val("");
                    $("#passWord").val("");
                    $("#phone").focus();
                    return false;
                }
            })
}
function register(){
	if ($("#phone").val() == "") {
                alert("用户名不能为空！");
                $("#phone").focus();
                return false;
            }
            if ($("#passWord").val() == "") {
                alert("密码不能为空！");
                $("#passWord").focus();
                return false;
            }
            if ($("#check_code").val() == "") {
                alert("验证码不能为空！");
                $("#check_code").focus();
                return false;
            }
            $.ajax({
                type: "POST",
                dataType:'json',
                url: "register.json",
                data:{"name":$("#phone").val(),"password":$("#passWord").val(),"check_code":$("#check_code").val()},
                success: function (data) { 
                    if(data["code"] == "200"){
                        //window.location.reload();
                        //return false;
                    }
                    alert("请确认您输入的用户名或密码输入是否正确！");
                    $("#phone").val("");
                    $("#passWord").val("");
                    $("#check_code").val("");
                    $("#phone").focus();
                    return false;
                }
            })
}
function send_code(){
	if ($("#phone").val() == "") {
                alert("手机号不能为空！");
                $("#phone").focus();
                return false;
            }
            $.ajax({
                type: "POST",
                dataType:'json',
                url: "send_code.json",
                data:{"name":$("#phone").val()},
                success: function (data) { 
                    if(data["code"] == "200"){
                        //window.location.reload();
                        //return false;
                    }
                    alert("请确认您输入的用户名或密码输入是否正确！");
                    $("#check_code").val("");
                    $("#check_code").focus();
                    return false;
                }
            })
}





